package system

import (
	"github.com/gin-gonic/gin"
	"server/model/common/response"
	sysRequest "server/model/system/request"
	sysService "server/service/system"
)

type FileApi struct {
}

// 获取文件列表
func (f *FileApi) Index(c *gin.Context) {
	//搜索条件
	p := &sysRequest.SysFileGetList{}
	if err := c.ShouldBind(p); err != nil {
		response.FailWithMessage(err.Error(), c)
		return
	}
	//日志列表
	logList, total, err := sysService.FileServiceApp.GetList(p)
	if err != nil {
		response.FailWithMessage(err.Error(), c)
		return
	}
	response.OkWithData(gin.H{
		"typeList": sysService.FileTypeList,
		"list":     logList,
		"total":    total,
		"pageNo":   p.PageNo,
	}, c)
}
